public without sharing class SFDCTEST {
   public ApexPages.StandardSetController setCon {get;set;}
   public Boolean hasNext {get; private set;}
   public Boolean hasPrevious {get; private set;}
   private Boolean isSuperUser = false;
   
   public SFDCTEST(ApexPages.StandardSetController setCon) 
   {
       setSuperUser();
       setStandardSetController();
       this.setCon.setPageSize(25);
       setNextPrevious();
    }
    
    private void setSuperUser()
    {
        Id profileId = UserInfo.getProfileId();
        Profile userProfile = [Select p.PermissionsPortalSuperUser From Profile p where p.Id = :profileId];
        
        if (userProfile.PermissionsPortalSuperUser)
            isSuperUser = true;
        else
            isSuperUser = false;
    }
    
    private void setStandardSetController()
    {
       this.setCon = setCon;
       
       if (isSuperUser)
           this.setCon = new ApexPages.StandardSetController(Database.getQueryLocator([select Id, CaseNumber, Subject, CreatedById, Priority, Status, Contact.Name, Account.Name, CreatedDate From Case Order By CreatedDate Desc LIMIT 10000]));
       else
       {
           Id userContactId = [Select u.ContactId From User u Where u.Id = :UserInfo.getUserId() LIMIT 1].ContactId;
           this.setCon = new ApexPages.StandardSetController(Database.getQueryLocator([select Id, CaseNumber, Subject, CreatedById, Priority, Status, Contact.Name, Account.Name, CreatedDate From Case Where CreatedById = :UserInfo.getUserId() Order By CreatedDate Desc LIMIT 10000]));
       }

    }
    public List<Case> getCases() {
        List<Case> cases = (List<Case>)setCon.getRecords();
        
        List<Case> actualCases = new List<Case>();
        
        for (Case c : cases)
        {
                    }
        
         return (List<Case>) setCon.getRecords();
    }
    public PageReference next() {
        if (hasNext)
            setCon.next();
        setNextPrevious();
        return null;
    }
    public PageReference previous() {
        if (hasPrevious)
            setCon.previous();
        setNextPrevious();
        return null;
    }
    private void setNextPrevious() {
        if (setCon.getHasNext()) {
            hasNext = true;
        }
        else {
            hasNext = false;
        }
        if (setCon.getHasPrevious()) {
            hasPrevious = true;
        }
        else {
            hasPrevious = false;
        }        
    }
}